<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>添加题目-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
	<!--star left-->
	<div class="column">
		<{include file="left_menu.html"}>
	</div>
	<div id="ContMianBox">
		<!--star子栏目-->
		<div class="sub-colum">
            <div class="tit"><{$left_menu_min.menu}></div>
            <ul>
                <{foreach from=$left_menu_min.list item=item}>
                <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                <{/foreach}>
            </ul>
        </div>
		<!--end子栏目-->
		<!--end left-->
		<div class="container narrow">
			<!--star conter-->
			<div class="cetContent">
				<div class="tit p-lr20">
					<span><a href="/tiku">题目管理</a></span>
				    <span class="curr">添加题目</span>
				    <span><a href="/tiku/import">导入题目</a></span>
				</div>
				<!--star内容区域-->
				<div class="mainScroll">
					<div class="mainContainer line-all">
						<!--star 001-->
						<form class="layui-form" method="post" action="<{$post_url}>" id="form_add_role">
							<input type="hidden" name="id" value="<{$topic_info['id']|default:'0'}>" />

							<div class="layui-form-item layui-form-text">
								<label class="layui-form-label">题目内容</label>
								<div class="layui-input-block">
									<{if isset($topic_info)}>
										<textarea name="subject_text" class="layui-textarea " lay-verify="content" disabled="disabled" id="subject_text_index"><{$topic_info.subject_text|default:""}></textarea>
									<{else}>
										<textarea name="subject_text" class="layui-textarea " lay-verify="content" id="subject_text_index"></textarea>
									<{/if}>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>科目</label>
								<div class="layui-input-inline">
									<select name="subject_id" id="subject" lay-filter="subject">
										<option value="0">请选择科目</option>
										<{foreach from=$subject item=item}>
											<option value="<{$item.id}>" <{if $topic_info['subject_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.title}></option>
										<{/foreach}>
									</select>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>章节</label>
									<div class="layui-input-inline">
										<select name="chapter_id" id="chapter_id" lay-filter="chapter_id">
											<option value="0">请选择章节</option>
											<{if $chapter_list_data|count  > 0}>
												<{foreach from=$chapter_list_data item=item}>
													<optgroup label="<{$item.title}>">
													<{if $item.sub|count > 0}>
														<{foreach from=$item.sub item=item1}>
															<option <{if $item1.id == $topic_info.chapter_id}> selected <{/if}> value="<{$item1.id}>"><{$item1.title}></option>
														<{/foreach}>
													<{/if}>
													</optgroup>
												<{/foreach}>
											<{/if}>
										</select>
									</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>题目分类</label>
								<div class="layui-input-inline">
									<select name="category_id" id="category_id">
										<option value="0">请选择分类</option>
										<{foreach from=$cagetory_list item=category}>
											<option value="<{$category.id}>" <{if $category.id == $topic_info.category_id|default:""}> selected <{/if}>><{$category.name}></option>
										<{/foreach}>
									</select>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>请选择省份</label>
									<div class="layui-input-inline">
										<select name="area_code" id="area_code">
											<option value="0">请选择省份</option>
											<{foreach from=$province_list item=province}>
												<option value="<{$province.area_code}>" <{if $province.area_code == $topic_info.area_code|default:""}> selected <{/if}>><{$province.area_name}></option>
											<{/foreach}>
										</select>
									</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>难度等级</label>
								<div class="layui-input-block">
									<input type="radio" name="difficulty_level" value="1" title="难" <{if $topic_info.difficulty_level|default:"" == 1}> checked <{/if}>>
									<input type="radio" name="difficulty_level" value="2" title="中" <{if $topic_info.difficulty_level|default:"" == 2 || !isset($topic_info)}> checked <{/if}>>
									<input type="radio" name="difficulty_level" value="3" title="易" <{if $topic_info.difficulty_level|default:"" == 3}> checked <{/if}>>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label">题目类型</label>
								<div class="layui-input-inline">
									<select id="q_type" name="type" lay-filter="q_type" <{if $topic_info.type|default:"" > 0}> disabled <{/if}>>
										<option value="1" <{if 1 == $topic_info.type|default:""}> selected <{/if}>>单选题</option>
										<option value="2" <{if 2 == $topic_info.type|default:""}> selected <{/if}>>多选题</option>
										<option value="3" <{if 3 == $topic_info.type|default:""}> selected <{/if}>>判断题</option>
										<option value="4" <{if 4 == $topic_info.type|default:""}> selected <{/if}>>计算分析题</option>
										<option value="7" <{if 7 == $topic_info.type|default:""}> selected <{/if}>>不定向选择题</option>
										<option value="8" <{if 8 == $topic_info.type|default:""}> selected <{/if}>>名词解释</option>
										<option value="9" <{if 9 == $topic_info.type|default:""}> selected <{/if}>>简答题</option>
									</select>
								</div>
							</div>

							<!--单选答案-->
							<{if $topic_info.type|default:"" == 1 || !isset($topic_info)}>
							<div id="an_radio_box">
								<{if isset($topic_result) AND $topic_result|count > 0}>
									<{foreach from=$topic_result key=key item=item}>
									<div class="layui-form-item">
										<div class="layui-inline">
											<label class="layui-form-label">题目答案<{$letter[$key]}></label>
											<div class="layui-input-block">
												<input type="text" name="an_radio_text[1]" value="<{$item.answer_text}>" lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;" disabled>
											</div>
										</div>

										<div class="layui-inline">
											<input type="radio" name="an_radio" value="1" title="正确答案" <{if $item.is_right == 1}>checked<{/if}> disabled>
										</div>
									</div>
									<{/foreach}>
								<{else}>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案A</label>
										<div class="layui-input-block">
											<input type="text" name="an_radio_text[1]" lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_radio" value="1" title="正确答案" checked>
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案B</label>
										<div class="layui-input-block">
											<input type="text" name="an_radio_text[2]" lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_radio" value="2" title="正确答案">
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案C</label>
										<div class="layui-input-block">
											<input type="text" name="an_radio_text[3]" lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_radio" value="3" title="正确答案">
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案D</label>
										<div class="layui-input-block">
											<input type="text" name="an_radio_text[4]" lay-verify="required" autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_radio" value="4" title="正确答案">
									</div>
								</div>
								<{/if}>
							</div>
							<{/if}>

							<!--多选答案-->
							<{if $topic_info.type|default:"" == 2 || !isset($topic_info)}>
							<div id="an_checkbox_box" style="<{if $topic_info.type|default:"" == 2}>display:block;<{else}>display: none;<{/if}>">
								<{if isset($topic_result) AND $topic_result|count > 0}>
									<{foreach from=$topic_result key=key item=item}>
									<div class="layui-form-item">
										<div class="layui-inline">
											<label class="layui-form-label">题目答案<{$letter[$key]}></label>
											<div class="layui-input-block">
												<input type="text" name="an_checkbox_text[1]" value="<{$item.answer_text}>"  autocomplete="off" class="layui-input" style="width: 500px;" disabled>
											</div>
										</div>

										<div class="layui-inline">
											<input type="checkbox" name="an_checkbox[1]" value="1" title="正确答案" <{if $item.is_right == 1}>checked<{/if}> disabled>
										</div>
									</div>
									<{/foreach}>
								<{else}>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案A</label>
										<div class="layui-input-block">
											<input type="text" name="an_checkbox_text[1]"  autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="checkbox" name="an_checkbox[1]" value="1" title="正确答案" checked>
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案B</label>
										<div class="layui-input-block">
											<input type="text" name="an_checkbox_text[2]"  autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="checkbox" name="an_checkbox[2]" value="1" title="正确答案">
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案C</label>
										<div class="layui-input-block">
											<input type="text" name="an_checkbox_text[3]"  autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="checkbox" name="an_checkbox[3]" value="1" title="正确答案">
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案D</label>
										<div class="layui-input-block">
											<input type="text" name="an_checkbox_text[4]"  autocomplete="off" class="layui-input" style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="checkbox" name="an_checkbox[4]" value="1" title="正确答案">
									</div>
								</div>
								<{/if}>
							</div>
							<{/if}>

							<!--选择题答案-->
							<{if $topic_info.type|default:"" == 3 || !isset($topic_info)}>
							<div id="an_choice_box" style='<{if $topic_info.type|default:"" == 3}>display:block;<{else}>display: none;<{/if}>'>
								<{if isset($topic_result) AND $topic_result|count > 0}>
									<{foreach from=$topic_result key=key item=item}>
									<div class="layui-form-item">
										<div class="layui-inline">
											<label class="layui-form-label">题目答案<{$letter[$key]}></label>
											<div class="layui-input-block">
												<input type="text" name="an_choice_text[1]"  value="<{$item.answer_text}>" autocomplete="off" class="layui-input" value="对" disabled style="width: 500px;" disabled>
											</div>
										</div>

										<div class="layui-inline">
											<input type="radio" name="an_choice" value="1" title="正确答案" <{if $item.is_right == 1}>checked<{/if}> disabled>
										</div>
									</div>
									<{/foreach}>
								<{else}>
								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案A</label>
										<div class="layui-input-block">
											<input type="text" name="an_choice_text[1]"  autocomplete="off" class="layui-input" value="对" disabled style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_choice" value="1" title="正确答案">
									</div>
								</div>

								<div class="layui-form-item">
									<div class="layui-inline">
										<label class="layui-form-label">题目答案B</label>
										<div class="layui-input-block">
											<input type="text" name="an_choice_text[2]"  autocomplete="off" class="layui-input" value="错" disabled style="width: 500px;">
										</div>
									</div>

									<div class="layui-inline">
										<input type="radio" name="an_choice" value="2" title="正确答案">
									</div>
								</div>
								<{/if}>
							</div>
							<{/if}>

							<!--选择题答案-->
							<{if $topic_info.type|default:"" == 4 || !isset($topic_info)}>
							<div id="an_analys_box" style='<{if $topic_info.type|default:"" == 4}>display:block;<{else}>display: none;<{/if}>'>
								<{if isset($topic_result) AND $topic_result|count > 0}>
									<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
										<ul class="layui-tab-title">
										<{foreach from=$topic_result key=key item=analys_item}>
											<li class="<{if $key == 0}>layui-this<{/if}>">第<{$key+1}>题</li>
										<{/foreach}>
										</ul>
										<div class="layui-tab-content">
											<{foreach from=$topic_result key=key item=analys_item}>
												<div class="layui-tab-item <{if $key == 0}>layui-show<{/if}>">
													<div class="layui-form-item">
														<label class="layui-form-label">分析题类型</label>
														<div class="layui-input-inline">
															<select name="analys[analys_type][1]" disabled lay-filter="a_type">
																<{if $analys_item.analys_type == 1}>
																<option value="1">填空题</option>
																<{else}>
																<option value="2">分录题</option>
																<{/if}>
															</select>
														</div>
													</div>

													<div class="layui-form-item layui-form-text">
														<label class="layui-form-label">子提干</label>
														<div class="layui-input-block">
															<textarea name="analys[subject_text][1]" class="layui-textarea" disabled="disabled"><{$analys_item.subject_text|strip_tags}></textarea>
														</div>
													</div>
													
													<{if $analys_item.analys_type == 1}>
													<div class="layui-form-item tk_answer">
														<div class="layui-inline">
															<label class="layui-form-label">子提干答案<{$analys_item.analys_type}></label>
															<div class="layui-input-block">
																<input type="text" name="analys[tk_answer_text][<{$analys_item.result[0].id}>]" value="<{$analys_item.result[0].answer_text}>" autocomplete="off" class="layui-input" style="width: 500px;" disabled>
															</div>
														</div>
													</div>
													<{else}>
													<{foreach from=$analys_item.result key=k item=analys_result}>
													<div class="layui-form-item fl_answer">
														<div class="layui-inline">
															<label class="layui-form-label">借贷方向</label>
															<div class="layui-input-block">
																<select disabled name="analys[type][<{$analys_result.aid}>][<{$analys_result.id}>]">
																	<option value="1" <{if $analys_result.type == 1}>selected<{/if}>>借</option>
																	<option value="2" <{if $analys_result.type == 2}>selected<{/if}>>贷</option>
																</select>
															</div>
														</div>
														<div class="layui-inline">
															<label class="layui-form-label">选择科目</label>
															<div class="layui-input-block">
																<input type="hidden" value="<{$analys_result.topic_subject_id}>" class="accounts" name="analys[<{$analys_result.aid}>][<{$analys_result.id}>]" >
																<input type="text" autocomplete="off" value="<{$analys_result.topic_subject_title}>" class="layui-input" readonly>
															</div>
														</div>
														<div class="layui-inline">
															<label class="layui-form-label">答案</label>
															<div class="layui-input-block">
																<input type="text" name="analys[answer_text][<{$analys_result.aid}>][<{$analys_result.id}>]" value="<{$analys_result.answer_text}>" disabled autocomplete="off" class="layui-input">
															</div>
														</div>
													</div>
													<{/foreach}>
													<{/if}>
											    </div>
											<{/foreach}>
										</div>
									</div>
								<{else}>
								<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
							  		<ul class="layui-tab-title">
									    <li class="layui-this">第一题</li>
									    <li>第二题</li>
									    <li>第三题</li>
									    <li>第四题</li>
									    <li>第五题</li>
								  	</ul>
									<div class="layui-tab-content">
										<!--第一题-->
									    <div class="layui-tab-item layui-show">
									    	<div class="layui-form-item">
												<label class="layui-form-label">分析题类型</label>
												<div class="layui-input-inline">
													<select name="analys[analys_type][1]" lay-filter="a_type">
														<option value="1">填空题</option>
														<option value="2">分录题</option>
													</select>
												</div>
											</div>

									    	<div class="layui-form-item layui-form-text">
												<label class="layui-form-label">子提干</label>
												<div class="layui-input-block">
													<{if isset($topic_info)}>
														<textarea name="analys[subject_text][1]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
													<{else}>
														<textarea class="layui-textarea layui-hide editor" name="analys[subject_text][1]"  id="editor3"></textarea>
													<{/if}>
												</div>
											</div>

											<div class="layui-form-item tk_answer">
												<div class="layui-inline">
													<label class="layui-form-label">子提干答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[tk_answer_text][1]"  value="" autocomplete="off" class="layui-input" style="width: 500px;">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][1][1]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][1][1]" >
														<input type="text" autocomplete="off" name="analys[topic_subject_title][1][1]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][1][1]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][1][2]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][1][2]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][1][2]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][1][2]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-inline fl_answer" style="display: none;">
												<label class="layui-form-label"></label>
												<a href="javascript:;" class="layui-btn layui-btn-primary add_analys"><i class="layui-icon"></i>新增选项</a>
											</div>
									    </div>

									    <!--第二题-->
									    <div class="layui-tab-item">
									    	<div class="layui-form-item">
												<label class="layui-form-label">分析题类型</label>
												<div class="layui-input-inline">
													<select name="analys[analys_type][2]" lay-filter="a_type">
														<option value="1">填空题</option>
														<option value="2">分录题</option>
													</select>
												</div>
											</div>

									    	<div class="layui-form-item layui-form-text">
												<label class="layui-form-label">子提干</label>
												<div class="layui-input-block">
													<{if isset($topic_info)}>
														<textarea name="analys[subject_text][2]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
													<{else}>
														<textarea class="layui-textarea layui-hide editor" name="analys[subject_text][2]"  id="editor4"></textarea>
													<{/if}>
												</div>
											</div>

											<div class="layui-form-item tk_answer">
												<div class="layui-inline">
													<label class="layui-form-label">子提干答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[tk_answer_text][2]"  value="" autocomplete="off" class="layui-input" style="width: 500px;">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][2][1]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][2][1]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][2][1]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][2][1]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][2][2]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][2][2]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][2][2]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][2][2]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-inline fl_answer" style="display: none;">
												<label class="layui-form-label"></label>
												<a href="javascript:;" class="layui-btn layui-btn-primary add_analys"><i class="layui-icon"></i>新增选项</a>
											</div>
									    </div>

									    <!--第三题-->
									    <div class="layui-tab-item">
									    	<div class="layui-form-item">
												<label class="layui-form-label">分析题类型</label>
												<div class="layui-input-inline">
													<select name="analys[analys_type][3]" lay-filter="a_type">
														<option value="1">填空题</option>
														<option value="2">分录题</option>
													</select>
												</div>
											</div>

									    	<div class="layui-form-item layui-form-text">
												<label class="layui-form-label">子提干</label>
												<div class="layui-input-block">
													<{if isset($topic_info)}>
														<textarea name="analys[subject_text][3]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
													<{else}>
														<textarea class="layui-textarea layui-hide editor" name="analys[subject_text][3]"  id="editor5"></textarea>
													<{/if}>
												</div>
											</div>

											<div class="layui-form-item tk_answer">
												<div class="layui-inline">
													<label class="layui-form-label">子提干答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[tk_answer_text][3]"  value="" autocomplete="off" class="layui-input" style="width: 500px;">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][3][1]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][3][1]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][3][1]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][3][1]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][3][2]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][3][2]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][3][2]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][3][2]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-inline fl_answer" style="display: none;">
												<label class="layui-form-label"></label>
												<a href="javascript:;" class="layui-btn layui-btn-primary add_analys"><i class="layui-icon"></i>新增选项</a>
											</div>
									    </div>

									    <!--第四题-->
									    <div class="layui-tab-item">
									    	<div class="layui-form-item">
												<label class="layui-form-label">分析题类型</label>
												<div class="layui-input-inline">
													<select name="analys[analys_type][4]" lay-filter="a_type">
														<option value="1">填空题</option>
														<option value="2">分录题</option>
													</select>
												</div>
											</div>

									    	<div class="layui-form-item layui-form-text">
												<label class="layui-form-label">子提干</label>
												<div class="layui-input-block">
													<{if isset($topic_info)}>
														<textarea name="analys[subject_text][4]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
													<{else}>
														<textarea class="layui-textarea layui-hide editor" name="analys[subject_text][4]"  id="editor6"></textarea>
													<{/if}>
												</div>
											</div>

											<div class="layui-form-item tk_answer">
												<div class="layui-inline">
													<label class="layui-form-label">子提干答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[tk_answer_text][4]"  value="" autocomplete="off" class="layui-input" style="width: 500px;">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][4][1]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][4][1]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][4][1]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][4][1]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][4][2]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][4][2]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][4][2]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][4][2]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-inline fl_answer" style="display: none;">
												<label class="layui-form-label"></label>
												<a href="javascript:;" class="layui-btn layui-btn-primary add_analys"><i class="layui-icon"></i>新增选项</a>
											</div>
									    </div>

									    <!--第五题-->
									    <div class="layui-tab-item">
									    	<div class="layui-form-item">
												<label class="layui-form-label">分析题类型</label>
												<div class="layui-input-inline">
													<select name="analys[analys_type][5]" lay-filter="a_type">
														<option value="1">填空题</option>
														<option value="2">分录题</option>
													</select>
												</div>
											</div>

									    	<div class="layui-form-item layui-form-text">
												<label class="layui-form-label">子提干</label>
												<div class="layui-input-block">
													<{if isset($topic_info)}>
														<textarea name="analys[subject_text][5]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
													<{else}>
														<textarea class="layui-textarea layui-hide editor" name="analys[subject_text][5]"  id="editor7"></textarea>
													<{/if}>
												</div>
											</div>

											<div class="layui-form-item tk_answer">
												<div class="layui-inline">
													<label class="layui-form-label">子提干答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[tk_answer_text][5]"  value="" autocomplete="off" class="layui-input" style="width: 500px;">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][5][1]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][5][1]">
														<input type="text" autocomplete="off" name="analys[topic_subject_title][5][1]" class="layui-input" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][5][1]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-form-item fl_answer" style="display: none;">
												<div class="layui-inline">
													<label class="layui-form-label">借贷方向</label>
													<div class="layui-input-block">
														<select name="analys[type][5][2]">
															<option value="1" selected>借</option>
															<option value="2">贷</option>
														</select>
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">选择科目</label>
													<div class="layui-input-block">
														<input type="hidden" class="accounts" name="analys[topic_subject_id][5][2]">
														<input type="text" autocomplete="off" class="layui-input" name="analys[topic_subject_title][5][2]" readonly onclick="choice_accounts(this)">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">答案</label>
													<div class="layui-input-block">
														<input type="text" name="analys[answer_text][5][2]"  autocomplete="off" class="layui-input">
													</div>
												</div>
											</div>

											<div class="layui-inline fl_answer" style="display: none;">
												<label class="layui-form-label"></label>
												<a href="javascript:;" class="layui-btn layui-btn-primary add_analys"><i class="layui-icon"></i>新增选项</a>
											</div>
									    </div>
								  	</div>
								</div>
								<{/if}>
							</div>
							<{/if}>

							<{if $topic_info.type|default:"" == 7 || !isset($topic_info)}>
								<div id="an_bdx_box" style='<{if $topic_info.type|default:"" == 7}>display:block;<{else}>display: none;<{/if}>'>
									<{if isset($topic_result) AND $topic_result|count > 0}>
										<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
											<ul class="layui-tab-title">
											<{foreach from=$topic_result key=key item=bdx_item}>
												<li class="<{if $key == 0}>layui-this<{/if}>">第<{$key+1}>题</li>
											<{/foreach}>
											</ul>
											<div class="layui-tab-content">
												<{foreach from=$topic_result key=key item=bdx_item}>
													<div class="layui-tab-item <{if $key == 0}>layui-show<{/if}>">
														<div class="layui-form-item layui-form-text">
															<label class="layui-form-label">子题干</label>
															<div class="layui-input-block">
																<textarea name="bdx[subject_text][1]" class="layui-textarea" disabled="disabled"><{$bdx_item.subject_text|strip_tags}></textarea>
															</div>
														</div>
														<{foreach from=$bdx_item.result key=k item=bdx_result}>
															<div class="layui-form-item">
																<div class="layui-inline">
																	<label class="layui-form-label">题目答案A</label>
																	<div class="layui-input-block">
																		<input type="text" lay-verify="title" disabled value="<{$bdx_result.answer_text}>" autocomplete="off" class="layui-input" style="width: 500px;">
																	</div>
																</div>
																<div class="layui-inline">
																	<input type="checkbox" value="1" <{if $bdx_result.is_right == 1}>checked<{/if}> title="正确答案" disabled>
																</div>
															</div>
														<{/foreach}>
												    </div>
												<{/foreach}>
											</div>
										</div>
									<{else}>
									<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
								  		<ul class="layui-tab-title">
										    <li class="layui-this">第一题</li>
										    <li>第二题</li>
										    <li>第三题</li>
										    <li>第四题</li>
										    <li>第五题</li>
									  	</ul>
										<div class="layui-tab-content">
											<!--第一题-->
										    <div class="layui-tab-item layui-show">
										    	<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">子题干</label>
													<div class="layui-input-block">
														<{if isset($topic_info)}>
															<textarea name="bdx[subject_text][1]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
														<{else}>
															<textarea class="layui-textarea layui-hide editor" name="bdx[subject_text][1]" id="editor8"></textarea>
														<{/if}>
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案A</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][1][1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][1][1]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案B</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][1][2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][1][2]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案C</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][1][3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][1][3]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案D</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][1][4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][1][4]" value="1" title="正确答案">
													</div>
												</div>
										    </div>

										    <!--第二题-->
										    <div class="layui-tab-item">
										    	<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">子题干</label>
													<div class="layui-input-block">
														<{if isset($topic_info)}>
															<textarea name="bdx[subject_text][2]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
														<{else}>
															<textarea class="layui-textarea layui-hide editor" name="bdx[subject_text][2]"  id="editor9"></textarea>
														<{/if}>
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案A</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][2][1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][2][1]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案B</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][2][2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][2][2]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案C</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][2][3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][2][3]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案D</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][2][4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][2][4]" value="1" title="正确答案">
													</div>
												</div>
										    </div>

										    <!--第三题-->
										    <div class="layui-tab-item">
										    	<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">子题干</label>
													<div class="layui-input-block">
														<{if isset($topic_info)}>
															<textarea name="bdx[subject_text][3]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
														<{else}>
															<textarea class="layui-textarea layui-hide editor" name="bdx[subject_text][3]"  id="editor10"></textarea>
														<{/if}>
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案A</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][3][1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][3][1]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案B</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][3][2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][3][2]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案C</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][3][3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][3][3]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案D</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][3][4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][3][4]" value="1" title="正确答案">
													</div>
												</div>

										    </div>

										    <!--第四题-->
										    <div class="layui-tab-item">
										    	<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">子题干</label>
													<div class="layui-input-block">
														<{if isset($topic_info)}>
															<textarea name="bdx[subject_text][1]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
														<{else}>
															<textarea class="layui-textarea layui-hide editor" name="bdx[subject_text][4]"  id="editor11"></textarea>
														<{/if}>
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案A</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][4][1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][4][1]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案B</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][4][2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][4][2]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案C</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][4][3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][4][3]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案D</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][4][4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][4][4]" value="1" title="正确答案">
													</div>
												</div>
										    </div>

										    <!--第五题-->
										    <div class="layui-tab-item">
										    	<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">子题干</label>
													<div class="layui-input-block">
														<{if isset($topic_info)}>
															<textarea name="bdx[subject_text][5]" class="layui-textarea" disabled="disabled"><{$topic_info.subject_text|strip_tags}></textarea>
														<{else}>
															<textarea class="layui-textarea layui-hide editor" name="bdx[subject_text][5]"  id="editor12"></textarea>
														<{/if}>
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案A</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][5][1]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][5][1]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案B</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][5][2]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][5][2]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案C</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][5][3]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][5][3]" value="1" title="正确答案">
													</div>
												</div>

												<div class="layui-form-item">
													<div class="layui-inline">
														<label class="layui-form-label">题目答案D</label>
														<div class="layui-input-block">
															<input type="text" name="bdx[checkbox_text][5][4]" lay-verify="title" autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
													
													<div class="layui-inline">
														<input type="checkbox" name="bdx[checkbox][5][4]" value="1" title="正确答案">
													</div>
												</div>
										    </div>
									  	</div>
									</div>
									<{/if}>
								</div>
								<{/if}>
							<div class="layui-form-item layui-form-text">
								<label class="layui-form-label" <{if isset($topic_info)}>style="background-color: #A5A552"<{/if}>>答案解析</label>
								<div class="layui-input-block">
									<textarea class="layui-textarea layui-hide editor" name="analysis" lay-verify="content" id="editor2"><{$topic_info.analysis|default:""}></textarea>
								</div>
							</div>

							<div class="layui-input-block">
								<button class="layui-btn" lay-submit="" lay-filter="sub_topic">立即提交</button>
								<button type="reset" class="layui-btn layui-btn-primary">重置</button>
							</div>
						</form>
						<!--end 001-->

					</div>

				</div>
				<!--end内容区域-->
		</div>
		<{include file="footer.html"}>
	<script>
		$(function(){
			$(".sub-colum").find('li').on('click',function(){//子栏目点击选中状态；
				$(this).addClass('curr').siblings().removeClass('curr');
			})
			$("#add_test_volume").click(function(){
				location.href = "/tiku/add_test_volume";
			})

		});

		layui.use(['form', 'jquery', 'layedit', 'element'], function(){
			var layedit = layui.layedit,form = layui.form(),$ = layui.jquery, element = layui.element();
			layedit.set({
			  	uploadImage: {
			    	url: '/upload/image' //接口url
		  		}
			});
			var subject_text_index = layedit.build("subject_text_index",{height:120})

			layui.form().on('select(q_type)', function(data){
				var type = $(data.elem).val();
				if(type == 1){
					$("#an_checkbox_box, #an_choice_box, #an_analys_box, #an_bdx_box").hide();
					$("#an_radio_box").show();
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "");
					$("#an_analys_box input[type='text']").attr("lay-verify", "");
					$("#an_radio_box input[type='text']").attr("lay-verify", "required");
				}else if(type == 2){
					$("#an_radio_box, #an_choice_box, #an_analys_box, #an_bdx_box").hide();
					$("#an_checkbox_box").show();
					$("#an_radio_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "");
					$("#an_analys_box input[type='text']").attr("lay-verify", "");
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "required");
				}else if(type == 3){
					$("#an_radio_box, #an_checkbox_box, #an_analys_box, #an_bdx_box").hide();
					$("#an_choice_box").show();
					$("#an_radio_box input[type='text']").attr("lay-verify", "");
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "");
					$("#an_analys_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "required");
				}else if(type == 4){
					$("#an_radio_box, #an_checkbox_box, #an_choice_box, #an_bdx_box").hide();
					$("#an_analys_box").show();
					$("#an_radio_box input[type='text']").attr("lay-verify", "");
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "");
					// $("#an_analys_box input[type='text']").attr("lay-verify", "required");
				}else if(type == 7){
					$("#an_radio_box, #an_checkbox_box, #an_choice_box, #an_analys_box").hide();
					$("#an_bdx_box").show();
					$("#an_radio_box input[type='text']").attr("lay-verify", "");
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "");
					$("#an_analys_box input[type='text']").attr("lay-verify", "");
				}else if(type == 8 || type == 9){
					$("#an_radio_box, #an_checkbox_box, #an_choice_box, #an_analys_box, #an_bdx_box").hide();
					$("#an_radio_box input[type='text']").attr("lay-verify", "");
					$("#an_checkbox_box input[type='text']").attr("lay-verify", "");
					$("#an_choice_box input[type='text']").attr("lay-verify", "");
					$("#an_analys_box input[type='text']").attr("lay-verify", "");
				}
			});

			layui.form().on('select(a_type)', function(data){
				var _this = $(data.elem);
				var type = _this.val();
				if(type == 1){
					_this.closest(".layui-tab-item").find(".tk_answer").show();
					_this.closest(".layui-tab-item").find(".fl_answer").hide();
				}else{
					_this.closest(".layui-tab-item").find(".tk_answer").hide();
					_this.closest(".layui-tab-item").find(".fl_answer").show();
				}
			})

			form.on('submit(sub_topic)', function(data){
				var subject_text = $.trim(layedit.getContent(subject_text_index));
				if(subject_text == ''){
					layer.msg('请填写题目内容', {icon: 5, anim: 6});
					return false;
				}

				if($("#subject").val() <= 0){
					layer.msg("请选择科目", {icon:5, anim: 6});
					return false;
				}

				if($("#chapter_id").val() <= 0){
					layer.msg("请选择章节", {icon:5, anim: 6});
					return false;
				}

				if($("#category_id").val() <= 0){
					layer.msg("请选择分类", {icon:5, anim: 6});
					return false;
				}

				if($("#area_code").val() <= 0){
					layer.msg("请选择省份", {icon:5, anim: 6});
					return false;
				}

				/*layer.alert(JSON.stringify(data.field.type), {
				  title: '最终的提交信息'
				})*/
				if($("#q_type").val() == 2){
					checked_dom = 0;
					$("#an_checkbox_box input[type='checkbox']").each(function (index,domEle){
						if($(domEle).next().hasClass("layui-form-checked")){
							checked_dom += 1;
						}
					});
					if(checked_dom < 2){
						layer.msg('多选题至少需要两个正确答案', {icon: 5, anim: 6});
						return false;
					}
				}
			});

			form.on('select(subject)', function(data){
				var ii = layer.load();
				var subject_id = $(data.elem).val();
				$("#chapter_id").html('<option value="0">请选择章节</option>');
				form.render('select');
				$.ajax({
					type: "POST",
					url: "/tiku/ignore_get_subject_chapter",
					dataType:"json",
					data:{subject_id:subject_id},
					success: function(result){
						layer.close(ii);
						if(result.code == 1){
							var html ='';
							console.log(result);
							$.each(result.chapter_list, function(i, obj) {
								html += '<optgroup label="'+ obj.title+'">';
								if(obj.sub){
	                                $.each(obj.sub, function(j, obj1) {
	                                	html += '<option value="'+obj1.id+'">'+obj1.title+'</option>';
	                                });
	                            }
	                            html += '</optgroup>'
							});
							$("#chapter_id").append(html);
							form.render('select');
						}
					}
				});
			});

			$(".add_analys").click(function(){
				var _this = $(this);
				var analys_total = _this.closest(".layui-tab-item").find(".fl_answer").length;
				var analys_sx = parseInt(_this.closest(".layui-tab-item").index())+1;
				var html = '<div class="layui-form-item fl_answer">';
				html +=	'<div class="layui-inline">';
				html +=	'<label class="layui-form-label">借贷方向</label>';
				html +=	'<div class="layui-input-block">';
				html += '<select name="analys[type]['+analys_sx+']['+analys_total+']">';
				html +=	'<option value="1" selected>借</option>';
				html +=	'<option value="2">贷</option>';
				html +=	'</select>';
				html +=	'</div>';
				html +=	'</div>';
				html +=	'<div class="layui-inline">';
				html +=	'<label class="layui-form-label">选择科目</label>';
				html +=	'<div class="layui-input-block">';
				html += '<input type="hidden" class="accounts" name="analys[topic_subject_id]['+analys_sx+']['+analys_total+']">';
				html +=	'<input type="text" autocomplete="off" name="analys[topic_subject_title]['+analys_sx+']['+analys_total+']" class="layui-input" readonly onclick="choice_accounts(this)">';
				html +=	'</div>';
				html +=	'</div>';
				html +=	'<div class="layui-inline">';
				html +=	'<label class="layui-form-label">答案</label>';
				html +=	'<div class="layui-input-block">';
				html +=	'<input type="text" name="analys[answer_text]['+analys_sx+']['+analys_total+']"  autocomplete="off" class="layui-input">';
				html +=	'</div>';
				html +=	'</div>';
				html += '<div class="layui-inline">';
				html += 	'<a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-small del_analys" onclick="del_analys(this)"><i class="layui-icon"></i></a>';
				html += '</div>';
				html +='</div>';
				_this.closest(".fl_answer").before(html);
				form.render('select');
			});

			
		});

		function del_analys(obj){
			$(obj).closest(".layui-form-item").remove();
		}

		function choice_accounts(obj){
			$(".accounts").attr("id", "");
			$(".accounts").siblings().attr("id", "");
			$(obj).siblings(".accounts").attr("id", "hidden_id");
			$(obj).attr("id", "hidden_id_text");
			layer.open({
				type: 2,
				title: '选择科目',
				shadeClose: true,
				shade: 0.8,
				area: ['20%', '70%'],
				maxmin: true,
				content: '/tk_accounts_subject' //iframe的url
			}); 
		}
	</script>

	</div>
</div>
</body>
</html>
